const Flow = require("../Flow");
const Player = require("../Player");
const Card = require("../Card");

const PLAYER_LIST = ["p1", "p2", "p3", "p4"].map(username => new Player({
	nickname: username
}));
const FLOW = new Flow(PLAYER_LIST);

PLAYER_LIST.slice(1).forEach(player => {
	player.removeCards(player.card_list);
	player.addCards("红心_1 方块_2 红心_3 红心_4 方块_5 红心_6 红心_7 红心_8 红心_9 方块_10 红心_J 红心_Q 红心_K".split(" ").map(txt => Card.getIns(txt)));

	FLOW.playerSubmitRes(player, {
		top: "红心_1 方块_2 红心_3".split(" "),
		mid: "红心_4 方块_5 红心_6 红心_7 红心_8".split(" "),
		btm: "红心_9 方块_10 红心_J 红心_Q 红心_K".split(" "),
	});
});

const win_player = PLAYER_LIST[0];
win_player.removeCards(win_player.card_list);
win_player.addCards("红心_1 方块_1 红心_3 方块_5 红心_6 红心_7 红心_8 红心_9 黑桃_Q 方块_Q 红心_Q 方块_K 红心_K".split(" ").map(txt => Card.getIns(txt)));

FLOW.playerSubmitRes(win_player, {
	top: "红心_1 方块_1 红心_3".split(" "),
	mid: "方块_5 红心_6 红心_7 红心_8 红心_9".split(" "),
	btm: "黑桃_Q 方块_Q 红心_Q 方块_K 红心_K".split(" "),
});


console.log(JSON.stringify(FLOW.calculateResults().find(results=>results.player_id===win_player.id), null, 4));